import requests

from common.get_headers import get_headers
from config import BASE_URL


class EmpApi(object):
    @classmethod
    def add_emp_user(cls,headers,body):
        add_url = f"{BASE_URL}"+"/api/sys/user/"

        res = requests.post(add_url,headers=headers,json=body)
        return res
    @classmethod
    def query_emp_user(cls,headers,id):
        query_url = f"{BASE_URL}"+"/api/sys/user/"+id
        res = requests.get(query_url,headers=headers)

        return res

    @classmethod
    def modify_emp_user(cls,headers,body):
        modify_url = f"{BASE_URL}" + "/api/sys/user/"

        res = requests.post(modify_url, headers=headers, json=body)
        return res

    @classmethod
    def delete_emp_user(cls,headers,id):
        delete_url = f"{BASE_URL}"+"/api/sys/user/"+id

        res = requests.delete(delete_url,headers=headers)
        return res


if __name__ == '__main__':
    body = {"mobile": "13800000002", "password": "123456"}
    headers = get_headers(body)
    id = "1532187975075561472"
    res = EmpApi.query_emp_user(headers, id)
    print(res.json())
    resp = EmpApi.delete_emp_user(headers,id)
    print(resp.json())